package singleton;/*
 * @auther 顶风少年
 * @mail dfsn19970313@foxmail.com
 * @date 2019-07-24 12:53
 * @notify
 * @version 1.0
 */

public class LazySingleton {

    private static  LazySingleton  instance = null;

    private LazySingleton(){}

    //该方法同步,避免 多个线程同时获取实例.
     public synchronized static  LazySingleton getInstance(){
        if(instance==null){
            instance = new LazySingleton();
        }
        return instance;
    }
}
